﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Resources;
using University.Workshop.Business;

namespace University.Workshop.WinApp
{
    public partial class RegisterProduct : Form
    {
        private ResourceManager resours;
        public RegisterProduct()
        {
            InitializeComponent();
            resours = new ResourceManager(typeof(RegisterAdministrator));
        }

        private void Register_Click(object sender, EventArgs e)
        {
            if(string.IsNullOrEmpty(textIdProducto.Text) || string.IsNullOrEmpty(textGroup.Text) || string.IsNullOrEmpty(textNameProduct.Text) || string.IsNullOrEmpty(textCost.Text))
            {
                string caption = this.resours.GetString("messageBox.Caption");
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                MessageBox.Show(this, "Todos los campos deben ser llenados", caption, buttons, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
            }
            else
            {
                RegistrationProduct.RegisterProduct(textIdProducto.Text.Trim(), textGroup.Text.Trim(), textNameProduct.Text.Trim(), textCost.Text.Trim());
                string caption = this.resours.GetString("messageBox.Caption");
                MessageBoxButtons buttons = MessageBoxButtons.OK;
                MessageBox.Show(this, "Los Datos fueron Cargados corectamente", caption, buttons, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign);
            
            }
        }

        private void Cancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        
    }
}
